// function createIncrementAction(data){
// return {type:'increment',data}
// }

// function createDecrementAction(data){
//     return {type:'decrement',data}
// }
import { INCREMENT, DECREMENT } from "./constant";
// import store from "./store";

//同步 action ，指 action 的值为 Object 类型的一般对象
export const createIncrementAction = (data) => ({ type: INCREMENT, data });
export const createDecrementAction = (data) => ({ type: DECREMENT, data });

//异步 action ，指 action 的值为函数
export const createIncrementAsyncAction = (data, time) => {
  return (dispatch) => {
    setTimeout(() => {
      dispatch(createIncrementAction(data));
    }, time);
  };
};
